﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ShopInspectionList.aspx.cs" Inherits="PatrolShop_ShopInspectionList" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>店铺巡检列表</title>
    <script src="../js/extTools.js" type="text/javascript"></script>
    <link href="../css/ExtStyle.css" rel="stylesheet" type="text/css" />
    <script src="../js/jquery/jquery-3.2.1.min.js" type="text/javascript"></script>

    <style type="text/css">
        .no_finish {
            font-size: 10px;
            font-weight: 600;
            text-shadow: none;
            padding: 3px 8px;
            background-color: #ed5565;
            color: #FFF;
            text-align: center;
            white-space: nowrap;
            vertical-align: baseline;
            border-radius: .25em;
        }

        .no_finish_1, .yes_finish_0 {
            display: none;
        }
        .custom_hide_1
        {
            display:none;
        }

        .yes_finish {
            font-size: 10px;
            font-weight: 600;
            text-shadow: none;
            padding: 3px 8px;
            background-color: #1ab394;
            color: #FFF;
            text-align: center;
            white-space: nowrap;
            vertical-align: baseline;
            border-radius: .25em;
        }
    </style>
    <script type="text/javascript">

        //var exportData = function (format) {
        //    App.FormatType.setValue(format);
        //    var store = App.GridPanel1.store;
        //    store.submitData(null, { isUpload: true });
        //};

        function details(shopName, cellmeta, record) {
            tifid = record.data["tif_id"];
            //shopName = encodeURI(shopName);
            var checkDate = record.data["tif_checkDate"];
            var url = '/PatrolShop/ShopInspectionResults.aspx?mid=3233&shopName=' + encodeURI(encodeURI(shopName)) + '&checkDate=' + checkDate;
            var temp = '<a href="#" style="color:blue" onclick="OpenWin(3233,\'' + url + '\');" >' + shopName + '</a>';
            //console.log(temp);
            return temp;
        }
        //跳转到index页面的js
        function OpenWin(id, url) {
            window.parent.ChildOpenNowWin(id, "巡检结果表", url);
        }

        //问题详情
        var btnDeleteTask_Click = function (tif_id) {
            //alert(tif_id); 
            Ext.Msg.confirm('提示', '确定是否需要删除！', function (YesNo) {
                if (YesNo == "yes")
                {
                    CompanyX.DeleteTask(tif_id);
                }
            });
        }

    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <ext:ResourceManager ID="ResourceManager1" runat="server" Theme="Neptune" />
            <ext:Viewport ID="Viewport1" runat="server">
                <LayoutConfig>
                    <ext:HBoxLayoutConfig Align="Stretch" />
                </LayoutConfig>
                <Defaults>
                    <ext:Parameter Name="margin" Value="2 0" Mode="Value" />
                </Defaults>
                <Items>

                    <ext:TabPanel ID="TabPanel1" runat="server" Flex="1">
                        <TopBar>
                            <ext:Toolbar ID="Toolbar1" runat="server" Layout="ColumnLayout">
                                <Items>
                                    <ext:ComboBox runat="server" ID="OperationAreaName" DisplayField="OperationAreaName" QueryMode="Local" TypeAhead="true" ValueField="OperationAreaName" Width="140" FieldLabel="分部" LabelWidth="35">
                                        <Store>
                                            <ext:Store ID="Store2" runat="server" AutoDataBind="true">
                                                <Model>
                                                    <ext:Model ID="Model2" runat="server">
                                                        <Fields>
                                                            <ext:ModelField Name="OperationAreaName" />
                                                        </Fields>
                                                    </ext:Model>
                                                </Model>
                                            </ext:Store>
                                        </Store>
                                        <DirectEvents>
                                            <Change OnEvent="GetBigAreaName" />
                                        </DirectEvents>
                                    </ext:ComboBox>

                                    <ext:ComboBox runat="server" ID="txtBigAreaName" DisplayField="BigAreaName" QueryMode="Local" TypeAhead="true" ValueField="BigAreaName" Width="140" FieldLabel="省份" LabelWidth="35">
                                        <Store>
                                            <ext:Store ID="Store_BigAreaName" runat="server" AutoDataBind="true">
                                                <Model>
                                                    <ext:Model ID="Model6" runat="server">
                                                        <Fields>
                                                            <ext:ModelField Name="BigAreaName" />
                                                        </Fields>
                                                    </ext:Model>
                                                </Model>
                                            </ext:Store>
                                        </Store>
                                        <DirectEvents>
                                            <Change OnEvent="GetArea" />
                                        </DirectEvents>
                                    </ext:ComboBox>

                                    <ext:ComboBox runat="server" ID="txtAreaName" DisplayField="AreaName" QueryMode="Local" TypeAhead="true" ValueField="AreaName" Width="140" FieldLabel="城市" LabelWidth="35">
                                        <Store>
                                            <ext:Store ID="Store_AreaName" runat="server" AutoDataBind="true">
                                                <Model>
                                                    <ext:Model ID="Model7" runat="server">
                                                        <Fields>
                                                            <ext:ModelField Name="AreaName" />
                                                        </Fields>
                                                    </ext:Model>
                                                </Model>
                                            </ext:Store>
                                        </Store>
                                    </ext:ComboBox>
                                    <ext:ComboBox runat="server" ID="TxtStoreManager" DisplayField="tif_shopManager" QueryMode="Local" TypeAhead="true" ValueField="tif_shopManager" Width="160" FieldLabel="店经理" LabelWidth="45">
                                        <Store>
                                            <ext:Store ID="tif_shopManager" runat="server" AutoDataBind="true">
                                                <Model>
                                                    <ext:Model ID="Model8" runat="server">
                                                        <Fields>
                                                            <ext:ModelField Name="tif_shopManager" />
                                                        </Fields>
                                                    </ext:Model>
                                                </Model>
                                            </ext:Store>
                                        </Store>
                                    </ext:ComboBox>
                                    <ext:ComboBox runat="server" ID="txtSupervisor" DisplayField="tif_supervisor" QueryMode="Local" TypeAhead="true" ValueField="tif_supervisor" Width="160" FieldLabel="巡店督导" LabelWidth="60">
                                        <Store>
                                            <ext:Store ID="Store_Supervisor" runat="server" AutoDataBind="true">
                                                <Model>
                                                    <ext:Model ID="Model_Supervisor" runat="server">
                                                        <Fields>
                                                            <ext:ModelField Name="tif_supervisor" />
                                                        </Fields>
                                                    </ext:Model>
                                                </Model>
                                            </ext:Store>
                                        </Store>
                                    </ext:ComboBox>
                                    <ext:DateField runat="server" ID="txtTimeBegin" LabelWidth="60" Editable="false" FieldLabel="巡检时间" Width="180">
                                        <%-- <DirectEvents>
                                            <Change OnEvent="StartDateField" />
                                        </DirectEvents>--%>
                                    </ext:DateField>
                                    <ext:DateField runat="server" ID="txtTimeEnd" LabelWidth="20" Editable="false" FieldLabel="至" Width="180" />

                                    <ext:Button ID="Button1" runat="server" Text="查询" Width="70" OnDirectClick="BtnQureyUser" UI="Info" Icon="Find">
                                        <DirectEvents>
                                            <Click>
                                                <EventMask ShowMask="true" Msg="加载中..."></EventMask>
                                            </Click>
                                        </DirectEvents>
                                    </ext:Button>
                                    <ext:Button ID="Button9" runat="server" Text="导出Excel" OnDirectClick="BtnOutExcel" Visible="true"
                                        UI="Info" Icon="PageExcel">
                                        <DirectEvents>
                                            <Click Timeout="900000">
                                                <EventMask ShowMask="true" Msg="玩命下载中...">
                                                </EventMask>
                                            </Click>
                                        </DirectEvents>
                                    </ext:Button>


                                    <%--<ext:Button ID="Button2" runat="server" Text="导出" Width="70" UI="Info" OnDirectClick="BtnExport">
                                        <DirectEvents>
                                            <Click>
                                                <EventMask ShowMask="true" Msg="加载中..."></EventMask>
                                            </Click>
                                        </DirectEvents>
                                    </ext:Button>--%>
                                </Items>
                            </ext:Toolbar>
                        </TopBar>

                        <Items>
                            <ext:GridPanel ID="GridPanel1" runat="server" Title="店铺完成率" TitleAlign="Right" Height="500">
                                <Store>
                                    <ext:Store ID="Store1" runat="server" PageSize="500" OnReadData="RefreshDataSet">
                                        <Model>
                                            <ext:Model ID="Model1" runat="server" IDProperty="店铺任务完成率">
                                                <Fields>
                                                    <ext:ModelField Name="rowNum" />
                                                    <ext:ModelField Name="tif_id" />
                                                    <ext:ModelField Name="tif_shopName" />
                                                    <ext:ModelField Name="tif_shopCode" />
                                                    <ext:ModelField Name="OperationAreaName" />
                                                    <ext:ModelField Name="BigAreaName" />
                                                    <ext:ModelField Name="AreaName" />

                                                    <ext:ModelField Name="tif_shopManager" />
                                                    <ext:ModelField Name="tif_checkDate" />
                                                    <ext:ModelField Name="tif_supervisor" />
                                                    <ext:ModelField Name="tif_questionCount" />
                                                    <ext:ModelField Name="tid_points" />
                                                    <ext:ModelField Name="new_tif_score" />
                                                    <ext:ModelField Name="tif_summary" />
                                                    <%--<ext:ModelField Name="Img_ID" />--%>
                                                    <ext:ModelField Name="tif_progress" />
                                                </Fields>
                                            </ext:Model>
                                        </Model>
                                    </ext:Store>
                                </Store>
                                <ColumnModel>
                                    <Columns>
                                        <ext:Column ID="Column11" runat="server" Text="序号" DataIndex="rowNum" Width="60" />
                                        <ext:Column ID="Column1" runat="server" Text="店铺名称" DataIndex="tif_shopName" Width="180">
                                            <Renderer Fn="details" />
                                        </ext:Column>
                                        <ext:Column ID="Column2" runat="server" Text="店铺代码" DataIndex="tif_shopCode" Width="80" />
                                        <ext:Column ID="Column3" runat="server" Text="分部" DataIndex="OperationAreaName" Width="120" />
                                        <ext:Column ID="Column12" runat="server" Text="省份" DataIndex="BigAreaName" Width="120" />
                                        <ext:Column ID="Column13" runat="server" Text="城市" DataIndex="AreaName" Width="120" />

                                        <ext:Column ID="Column4" runat="server" Text="店经理" DataIndex="tif_shopManager" Width="80" />
                                        <ext:Column ID="Column5" runat="server" Text="巡店时间" DataIndex="tif_checkDate" Width="100" />
                                        <ext:Column ID="Column6" runat="server" Text="巡店督导" DataIndex="tif_supervisor" Width="80" />
                                        <ext:Column ID="Column7" runat="server" Text="问题数" DataIndex="tif_questionCount" Width="60" />
                                        <ext:Column ID="Column8" runat="server" Text="扣分" DataIndex="tid_points" Width="60" />
                                        <ext:Column ID="Column9" runat="server" Text="得分" DataIndex="new_tif_score" Width="60" />
                                        <ext:Column ID="Column10" runat="server" Text="备注" DataIndex="tif_summary" Width="200" />
                                        <%--<ext:Column ID="Column11" runat="server" Text="图片" DataIndex="Img_ID" Width="80" />--%>
                                        <ext:TemplateColumn ID="TemplateColumn1" runat="server" Text="状态" DataIndex="tif_progress">
                                            <Tpl runat="server">
                                                <Html>
                                                    <label class="no_finish no_finish_{tif_progress}">未完成</label>
                                                    <label class="yes_finish yes_finish_{tif_progress}">已完成</label>
                                                </Html>
                                            </Tpl>
                                        </ext:TemplateColumn>
                                        <ext:TemplateColumn ID="TemplateColumn2" runat="server" Text="操作" DataIndex="ProblemDetails" TemplateString='<a href=# class="custom_hide_3{tif_progress}" onclick=btnDeleteTask_Click("{tif_id}")>删除</a>' />

                                    </Columns>
                                </ColumnModel>

                                <BottomBar>
                                    <ext:PagingToolbar ID="PagingToolbar1" runat="server">
                                        <Items>
                                            <ext:Label ID="Label1" runat="server" Text="每页显示:" />
                                            <ext:ToolbarSpacer ID="ToolbarSpacer1" runat="server" Width="10" />
                                            <ext:ComboBox ID="ComboBox1" runat="server" Width="80">
                                                <Items>
                                                    <ext:ListItem Text="500" />
                                                </Items>
                                                <SelectedItems>
                                                    <ext:ListItem Value="500" />
                                                </SelectedItems>
                                                <Listeners>
                                                    <Select Handler="#{GridPanel1}.store.pageSize = parseInt(this.getValue(), 10); #{GridPanel1}.store.reload();" />
                                                </Listeners>
                                            </ext:ComboBox>

                                        </Items>
                                        <Plugins>
                                            <ext:ProgressBarPager ID="ProgressBarPager1" runat="server" />
                                        </Plugins>
                                    </ext:PagingToolbar>
                                </BottomBar>
                            </ext:GridPanel>
                        </Items>




                    </ext:TabPanel>
                </Items>
            </ext:Viewport>
        </div>
    </form>
</body>
</html>

